package cn.ycbjie.ycaudioplayer.newpack.linkagescroll.iapiserver;

import java.io.IOException;

import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;

/**
 * PackageName: com.synjones.httptest.http
 * Des:
 * Author: qinzongke
 * Date: 2018/9/11
 */
public class HeaderInterceptor implements Interceptor {



    @Override
    public Response intercept(Chain chain) throws IOException {
        //添加header
        Request request = chain.request().newBuilder().header("user-agent", "").build();
        // 添加新的参数
//        HttpUrl url = request.url().newBuilder().addQueryParameter("scope", "").build();
//        request = request.newBuilder().url(url).build();
        Response response = chain.proceed(request);
        String cacheControl = request.cacheControl().toString();
        return response.newBuilder()
                .header("Cache-Control", cacheControl)
                .removeHeader("Pragma")
                .build();

    }

}
